package cn.mhome.merchant.framework.controller;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.IncorrectCredentialsException;
import org.apache.shiro.subject.Subject;

import cn.mhome.merchant.framework.data.UserAuthVO;


public class BaseController {
	/**
	 * 获取当前用户
	 * @return
	 */
    public UserAuthVO getCurrentUser(){
    	try {
    		Subject currentUser = SecurityUtils.getSubject();
            UserAuthVO userInfo = (UserAuthVO) currentUser.getPrincipal();
            return userInfo;
		} catch (Exception e) {
			throw new IncorrectCredentialsException("登陆超时，请重新登陆");
		}
    }
}
